package com.hanamaki.exception.demo01;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;

/**
 * @author hanamaki
 * @version 1.0
 * @date 2021/6/28 14:15
 */
public class Demo03 {

    public static void main(String[] args) {

        int a = 1; // ctrl + shift + enter
        int b = 0;

//        if (b == 0) {
////            如果  b==0的时候抛出异常
//            throw new ArithmeticException();
//        }

//        try {
//            new Demo03().test();
//        } catch (ArithmeticException e) {
//            System.out.println("ArithmeticException");
//        } catch (Exception e) {
//            System.out.println("😊");
//        }

        try {
            new Demo03().filePath();
        } catch (FileNotFoundException e) {
            System.out.println("❤🧡🧡");
        }finally {
          // 处理善后工作
        }


    }

    public void test() throws ArithmeticException{
        int a=1, b = 0;
        System.out.println(a / b);
    }

    public void filePath() throws FileNotFoundException {
//        alt +enter
            new FileInputStream(new File(""));
    }
}
